package com.gsn.poker.play;

import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.scenes.scene2d.Group;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.gsn.desktop.engine.ActorUtility;
import com.gsn.desktop.engine.GdxUtility;
import com.gsn.engine.myplay.GsnGame;
import com.gsn.engine.template.GsnLabel;
import com.gsn.poker.asset.PokerTexture;

public class BetTextGroup extends Group{
	public long total;
	public long theo;
	public Label tongLb;
	public Label theoLb;
	
	public Label chuTongLb;
	public Label chuTheoLb;
	
	public BetTextGroup(long total, long theo) {
		transform = false;
		this.total = total;
		this.theo = theo;		
		
		tongLb = new Label("$" + ActorUtility.formatNumber(total), new Label.LabelStyle(PokerTexture.inst().fontSmall, new Color(1, 1, 0, 1)));
		theoLb = new Label("$" + ActorUtility.formatNumber(theo), new Label.LabelStyle(PokerTexture.inst().fontSmall, new Color(0, 1, 1, 1)));
		
		chuTongLb = new Label("Tổng: ", new Label.LabelStyle(PokerTexture.inst().fontSmall, new Color(1, 1, 0, 1)));
		chuTheoLb = new Label("Theo: ", new Label.LabelStyle(PokerTexture.inst().fontSmall, new Color(0, 1, 1, 1)));
		
		Image bg = new Image(PokerTexture.inst().betSum);
		this.width = bg.width;
		this.height = bg.height;
		
		addActor(theoLb);
		addActor(tongLb);
		
		addActor(chuTongLb);
		addActor(chuTheoLb);
		
		chuTongLb.y = tongLb.y = this.height * 0.55f;
		chuTheoLb.y = theoLb.y = 0;
		tongLb.x = (this.width * 0.8f - tongLb.width)/2 + this.width * 0.20f;
		theoLb.x = (this.width * 0.8f - theoLb.width)/2 + this.width * 0.20f;
		this.addActorAt(0, bg);
	}
	
	public void update(long total, long theo)
	{
		this.total = total;
		this.theo = theo;
		tongLb.setText("$" + ActorUtility.formatNumber(total));
		theoLb.setText("$" + ActorUtility.formatNumber(theo));		
		addActor(theoLb);
		addActor(tongLb);
		tongLb.x = (this.width * 0.8f - tongLb.getTextBounds().width)/2 + this.width * 0.20f;
		theoLb.x = (this.width * 0.8f - theoLb.getTextBounds().width)/2 + this.width * 0.20f;
		System.out.println(tongLb.width);
		
	}
}
